public class stringbufferandstringbuilder {
    public static void main(String[] args) {
        //StringBuffer stringBuffer ="123"; 不能直接赋值

        StringBuilder stringBuilder = new StringBuilder("abcd");
        stringBuilder.append(1);
        stringBuilder.append("po");
        stringBuilder.append("abcd").append(12.5);
        System.out.println(stringBuilder);

        //指定下标插入字符
        stringBuilder.setCharAt(0,'k');
        System.out.println(stringBuilder);


        //指定下标插入字符串
        stringBuilder.insert(1,"oooooooooooooooooo");
        System.out.println(stringBuilder);


        //反转字符串
        stringBuilder.reverse();
        System.out.println(stringBuilder);


        //把stringBuilder转换成string 不能强转,调用tostring方法
        String str = stringBuilder.toString();
        System.out.println(str);

    }
}
